package com.mef.smsplat.util;

import com.mef.smsplat.domain.AirportInfoDomain;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;

public class AirportUtil {
	
	/**
	 * 根据三字码得到机场名
	 * @param code 三字码
	 * @return
	 */
	public static String getAirportName(String code){
		CacheManager cacheManager=(CacheManager) ApplicationContextUtil.getContext().getBean("cacheManager");
		Cache cache = cacheManager.getCache("staticCache");
		Element e= cache.get(code);
		if(e==null)
			return code;
		
		return ((AirportInfoDomain)e.getObjectValue()).getAirportName();
	}
	
}
